package Tools;

import java.util.List;

import Tools.TModel.TCommand;
import Tools.TModel.TKey;

/**
 * This abstract class contains base methods and field  and describes signature of abstract methods
 * which should be overridden in the class of successor which  implements functions of CMD.
 * @author Ivan
 */
public abstract class ACommand {

    public TCommand typeOfCommand;
    private StringBuffer stringPrintResult;

    public ACommand(TCommand typeOfCommand) {

        this.typeOfCommand = typeOfCommand;

    }

    /**
     * Method which implements action of command
     * @param parameters
     * @param key
     * @return
     * @throws Exception
     */
    public abstract boolean action(List<String> parameters, TKey key) throws Exception;

    /**
     * This method used for checks of specified parameters and returns those of them that is valid
     * @param parameters
     * @return
     * @throws Exception
     */
    public abstract List<String> setParameters(List<String> parameters) throws Exception;

    public String getPrintResult() {
        return stringPrintResult.toString();
    }

    protected void setPrintResult(StringBuffer stringPrintResult) {
        this.stringPrintResult = stringPrintResult;
    }
}
